/*
 * @Author: Bo
 * @Date: 2022-03-23 09:15:52
 */
// import request from "./request";

import { AxiosPromise, AxiosResponse } from 'axios'
import { Interceptors } from './request'

// 请求配置
class HttpServer {
  axios: any
  // 获取axios实例
  constructor() {
    this.axios = new Interceptors().getInterceptors()
  }
  // 简单封装一下方法
  request(config: any): AxiosPromise {
    return new Promise((resolve, reject) => {
      this.axios(config)
        .then((res: AxiosResponse) => {
          resolve(res.data)
        })
        .catch((err: any) => {
          reject(err)
        })
    })
  }
}
const http = new HttpServer()
export default http
